
//
//  MeCollectionHeaderView.m
//  高仿萝卜书摘
//
//  Created by 谢俊逸 on 2016/11/25.
//  Copyright © 2016年 谢俊逸. All rights reserved.
//

#import "MeCollectionHeaderView.h"
#import "XJYHeader.h"
#import "MeCollectionTopView.h"

@interface MeCollectionHeaderView()<XJYTopScrollViewDelagate>



@property (nonatomic,strong) UIPageControl *pageControl;

@end
@implementation MeCollectionHeaderView

- (id)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if(self){
        self.backgroundColor = [UIColor whiteColor];
        [self setupUI];
        
    }
    return self;
}

- (void)setupUI{
    MeCollectionTopView *topView = [[MeCollectionTopView alloc]initWithFrame:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height - 20)];
    topView.XJYTopScrollViewDelegate = self;
    [self addSubview:topView];
    
    
    
        UIPageControl *pageControl = ({
            pageControl = [[UIPageControl alloc]initWithFrame:RectMake_LFL(self.frame.size.width/2 - 30, self.frame.size.height - 20, 60, 20)];
    
            //autoresizingMaske
            pageControl.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleTopMargin;
            pageControl.hidesForSinglePage = YES;
            //color
            pageControl.pageIndicatorTintColor = [UIColor grayColor];
            pageControl.currentPageIndicatorTintColor = [UIColor orangeColor];
            pageControl.numberOfPages = 2;
            pageControl.currentPage = 0;
            pageControl;
        });
        self.pageControl = pageControl;
        [self addSubview:pageControl];
}


#pragma mark XJYTopScrollViewDelagate
- (void)XJYTopScrollCurremtPage:(NSInteger)currentPage{
    _pageControl.currentPage = currentPage;
}

@end
